//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;

namespace OpenLS.Spreadsheet
{
    class PartialRowOrColumnRange
    {
        public PartialRowOrColumnRange(Worksheet worksheet, CellAddress topLeft, int length, RowOrColumn direction)
        {
            this.worksheet = worksheet;
            this.topLeft = topLeft;
            Index = topLeft.Row;
            for (int i = 0; i < length; i++)
                if (direction == RowOrColumn.Column)
                    Cells.Add(worksheet[topLeft + new CellRelativeAddress(i, 0)]);
                else
                    Cells.Add(worksheet[topLeft + new CellRelativeAddress(0, i)]);
        }
        public readonly int Index;
        Worksheet worksheet;
        CellAddress topLeft;
        internal List<Cell> Cells = new List<Cell>();
        public IEnumerable<Cell> GetNonEmptyCells() { return Cells; }
    }
    enum RowOrColumn
    {
        Row,
        Column
    }
}
